#ifndef __BSP_UART_H__
#define __BSP_UART_H__


#include "at32f403a_407.h"

#define UART4_MAX      97


typedef struct st_uart4{
	uint8_t rx_buf[UART4_MAX];
	uint8_t conversion_time;
	uint8_t rx_cnt;
	union{
		uint8_t bits;
		struct{
			uint8_t b_recving : 1;
			uint8_t b_recved : 1;
			uint8_t b_sending : 1;
			uint8_t b_sended : 1;
			uint8_t b_unuse : 4;
		}bit;
	}status;
}st_uart4;


extern st_uart4 st_485;
void at32_rs485_init(void);
void rs485_send_data(u8* buf, u8 cnt);
#endif


